﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace University.Workshop.Presentation.Square.Register
{
    /// <summary>
    /// Interaction logic for RegisterSquare.xaml
    /// </summary>
    public partial class RegisterSquare : Page
    {
        public RegisterSquare()
        {
            InitializeComponent();
        }

        private void CancelBtn_Click(object sender, RoutedEventArgs e)
        {
            this.NavigationService.Navigate(new SearchSquare());
        }

        private void SearchImageBtn_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.FileName = "Document"; // Default file name
            dlg.DefaultExt = ".png"; // Default file extension
            dlg.Filter = "Text documents (.png)|*.jpg"; // Filter files by extension 
            // Show open file dialog box
            Nullable<bool> result = dlg.ShowDialog();
            
            // Process open file dialog box results 
            if (result == true)
            {
                // Open document 
                LocationImageTxt.Text = dlg.FileName;

BitmapImage logo = new BitmapImage();
logo.BeginInit();
logo.UriSource = new Uri(dlg.FileName);
logo.EndInit();

SquareImageImg.Source = logo;
            }
        }
    }
}
